module.exports = `
  type AuthToken {
    id: Int
    access_token: String!
    expires_in: Int!
    user_id:Int!
    avatar:String
    nick_name:String
  }

  type User {
    id: ID!
    nickName: String
    avatarUrl: String
    groups: [Group]
  }

  extend type Query {
    # 获取认证用户信息
    getLoginer: User!
  }
  extend type Mutation {
    # 微信小程序登录，利用code获取session key
    wxLogin(code: String!, appId: String): AuthToken!
    # 解密微信小程序用户信息，并更新数据库用户信息
    wxUserInfo(encryptedData: String, iv: String): AuthToken!
    # 自定义用户的昵称和头像
    updateUserProfile(nickName: String!, avatarUrl: String!, roles: String): AuthToken!
    # 获取微信登录URL，用于跳转登录
    buildOauthUrl(url: String!, state: String): String!
    # 用从微信获得的code登录
    oauthLogin(code: String!, isWeixinBrowser: Int): AuthToken!
  }
`
